
#pragma once

#ifndef _WEBKIT_NEW

#include "ListenSocket.h"

#define Security_PORT	843

class CPolicyDelegate;
class CFlashSecuritySocket : public CListenSocket
{
public:
	CFlashSecuritySocket(CPolicyDelegate *caller);
	~CFlashSecuritySocket();
	__forceinline bool Start(){ return CListenSocket::Start(Security_PORT, 1); }
protected:
	LPVOID initClientThread() override;
	void doneClientThread() override;
	bool startClientThread(SOCKET cltSock) override;
	void procFinished() override { doneClientThread(); }

	CPolicyDelegate *m_Caller;
};

class CSecurityThread
{
public:
	void init(CPolicyDelegate *caller);
	bool startThread(SOCKET sock);
	void stopThread(bool wait);
	void ProcCltThread();
protected:
	bool threadRunning();

	SOCKET cltSock;
	HANDLE hCltThread;
	bool stopCltThread;
	CPolicyDelegate *m_Caller;
};

#endif	//_WEBKIT_NEW
